package com.chen.controllers.windows;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import com.chen.service.TTestService;

import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.portal.Window;
/**
 * 测试异常捕获。直接接收由service发出的异常并捕获处理。
 * @author ninja.hzw
 */
@Path("exceptionTest")
public class ExceptionTestController {
	
	@Autowired
	private TTestService testService;

	// 方法名是什么不要紧，关进是@Get代表了这个方法用于处理对/exceptionTest的GET请求\
	// request 对象可以作为参数传入 也可以通过inv.getRequest() 获得。
	@Get
	public String test(Invocation inv, Window window , HttpServletRequest request) {
		try {
			testService.testSleep();
		} catch(Exception e){
			return "";
		}
		return "exception_pages/exception1";
	}
}
